package com.founder.chd_daily_query.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.founder.chd_daily_query.service.BidService;
import com.founder.chd_daily_query.util.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.Set;

@Service
public class BidServiceImpl implements BidService {

    @Autowired
    ApplicationContext applicationContext;
    @Autowired
    private RedisTemplate<String,String> redisTemplate;


    @Override
    public JSONObject getShortInfo() {
        Set<String> bid_count = redisTemplate.opsForZSet().range("BID_COUNT", 0, 1);
        Object[] objects = bid_count.stream().toArray();
        return JsonUtil.parse((String) (objects[0]));
    }
}
